package com.ruoyi.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.Contact;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * SpringDoc OpenAPI配置类
 *
 * @author ruoyi
 */
@Configuration
public class SwaggerConfig {

    @Value("${springdoc.info.title:AI智能家居设计系统接口文档}")
    private String title;

    @Value("${springdoc.info.description:AI智能家居设计系统接口描述}")
    private String description;

    @Value("${springdoc.info.version:1.0.0}")
    private String version;

    /**
     * 创建API
     */
    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title(title)
                        .description(description)
                        .version(version)
                        .contact(new Contact()
                                .name("RuoYi")
                                .url("https://ruoyi.vip")));
    }
}
